PATHMac OS 8 and 9 Developer Documentation > Human Interface Toolbox > Appearance Manager >

Programming With the Appearance Manager


Obtaining Device Color and Depth Information

To be truly theme-compliant, your program should use the QuickDraw function DeviceLoop with all of its drawing. DeviceLoop automatically supplies your application with the color and depth information that you need to supply to many Appearance Manager functions.

If your program is not drawing via DeviceLoop , your program should obtain the color and depth information itself. You typically do this by calling the QuickDraw function GetGDevice . Your program then examines the GDevice structure for the current device's color and depth information, as shown in Listing 3-2 . Note that the example shown may not produce optimal results when you are drawing across multiple monitors with different bit depths.

Listing 3-2   Obtaining color and depth information for the current device

// Is the current device a color device?
static pascal Boolean MyGraphicDeviceIsColor (GDHandle gdh)
{
    if (!gdh) gdh = GetGDevice ( );
    return ((1 << gdDevType) & (**gdh).gdFlags) != 0;
}

// What is the bit depth of the current device?
static pascal short MyGetGraphicDeviceDepth (GDHandle gdh)
{
    if (!gdh) gdh = GetGDevice ( );
    return (**((**gdh).gdPMap)).pixelSize;
}

© 1999 Apple Computer, Inc. – (Last Updated 29 April 99)